package com.oms.app.user.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.oms.app.shop.dao.IShopDAO;
import com.oms.app.user.dao.IModuleDAO;
import com.oms.app.user.model.Module;
import com.oms.core.dao.impl.GeneralDAO;

/**
 * controller
 * @author wtj
 * @date Sep 10, 2012  10:13:39 PM
 */

public class ModuleDAOImpl extends GeneralDAO<Object, String> implements IModuleDAO {

	@Override
	public List getModuleList(HttpServletRequest request) {
		return this.queryForList("getAll",new HashMap<String, String>());
	}

	@Override
	public int delete(String primaryKey) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Object get(String primaryKey) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean saveOrUpdateModule(Module moduleForm) {
		try {
			this.insert(moduleForm);
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	@Override
	public boolean deleteModule(String PK) {
		try {
			this.delete("delete", PK);
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	@Override
	public List getRoleOfModule(Map map) {
		return this.queryForList("getRoleOfModule",map);
	}
	// 修改模块（资源）可用状态
	public boolean modifyStatus(Map map){
		try {
			this.update("modifyStatus", map);
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	@Override
	public int update(Object entity) {
		return super.update(entity);
	}

	@Override
	public void update(String sqlId, Object parameters) {
		super.update(sqlId, parameters);
	};
	
}
